package bean;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author akay
 */
public class DBConncetion {

    static String driver = "com.mysql.jdbc.Driver";
    static String adres = "jdbc:mysql://localhost:3306/aractakip";
    static String kullanici = "root";
    static String sifre = "";
    Connection con ;
    
    public DBConncetion() {
    }
    
    
  public Connection getConnect() {
        
        try {
            Class.forName(driver);
            con = DriverManager.getConnection(adres, kullanici, sifre);
            con.setAutoCommit(true);
            return con;
        } catch (Exception e) {
            System.err.println("veri tabanina baglanilamadi!");
            e.printStackTrace();
        }

       return con;
    }
    
    public void closeConnect(Connection connection) {
                try {
                        connection.close();
                } catch (SQLException e) {
                        System.err.println("veri tabani kapatilamadi!");
                }
        }
  
}
